#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
const int N = 1e6 + 5;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n), b(m + 2);
    b[0] = 0, b[m + 1] = 1e9 + 5;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 1; i <= m; i++) cin >> b[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int ans = 0;
    for (int i = 0; i <= m; i++) {
        int l = upper_bound(a.begin(), a.end(), b[i]) - a.begin();
        int r = lower_bound(a.begin(), a.end(), b[i + 1]) - a.begin();
        ans = max(ans, r - l);
    }
    if (ans)
        cout << ans << endl;
    else
        cout << "Impossible" << endl;

    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();

    return 0;
}